<?php echo $header; ?>

<style>
/*
 * Begin show text when mouseover
 */

#tooltips_shipping {
	display:none;
	position:absolute;
	z-index:1000;
	-moz-border-radius:4px;
	-webkit-border-radius:4px;	 
}
.tooltips_shipping {
	text-decoration: underline;
	font-weight: bold;
	cursor: default;
}

.tooltips_shipping_style{
	background:#5a85a5 10px center no-repeat;
	color:white;
	min-height:50px;
	padding:10px 20px 10px 10px;
	margin-left: 170px;
	width:300px;
	opacity:0.95;   
}

#tool_1 {
	display:none;
	position:absolute;
	z-index:1000;
	-moz-border-radius:4px;
	-webkit-border-radius:4px;	 
}

.tooltip-style1_1 {
	background:#5a85a5 10px center no-repeat;
	color:white;
	min-height:30px;
	padding:10px 20px 10px 10px;
	opacity:0.95;   
	width:100px;
}
.tooltip-style2 {
	background:#363636;
	padding:3px;
	color:white;
	text-align:center;
}
pre {
	font-size:10px;
}
  
 </style>    
<script type="text/javascript">
 /*
  * Begin show text when mouseover
  */
 	jQuery(document).ready(function() {		
		jQuery(".tooltips_shipping").hover(
			function(){ jQuery('#tooltips_shipping').css({ display: "block" }); },
			function() { jQuery('#tooltips_shipping').css({ display: "none" }); }
		);
		
		/*
		jQuery(".tooltips_1").hover(
			function(){ jQuery(this).contents("div:last-child").css({ display: "block" }); },
			function() { jQuery(this).contents("div:last-child").css({ display: "none" }); }
		);
		*/
        /*
		jQuery(".tooltips_1").mousemove(function(e) {
			var mousex = e.pageX-400;
			var mousey = e.pageY-300;
			jQuery(this).contents("div:last-child").css({  top: mousey, left: mousex });
		});
		*/
		//jQuery(".tooltips_1").bind('click', tabSizeClick); 
	});
</script>

<!-- Content -->
<div id="main" class="p13t">
    <!-- Left column -->
    <?php echo $column_left; ?>
    
    <div id="col2" class="w709">
        <div class="box_tt">               
            <?php if(1==0){ ?>                    
            <h4 class="float_left p5t">Produkter</h4>
            <?php } ?>        
            <h4 class="float_left p5t">           
                <?php foreach ($breadcrumbs as $breadcrumb) { ?> 
                    <?php if($breadcrumb['href']) { ?>
                        <span class="breadcrumb_sep"><?php echo $breadcrumb['separator']; ?></span>
                        <a href="<?php echo $breadcrumb['href']; ?>" ><span class="breadcrumb_text"><?php echo $breadcrumb['text']; ?></span></a>
                    <?php }else{ ?>
                        <span class="breadcrumb_sep"><?php echo $breadcrumb['separator']; ?></span><span class="breadcrumb_text"><?php echo $breadcrumb['text']; ?></span>                    
                    <?php } ?>
                <?php } ?>
            </h4>
            <!-- span class="float_right"><a href="<?php echo $back; ?>"><img src="catalog/view/theme/<?php echo $template; ?>/images/bt_tibage.png"/></a></span --> 
        </div>
		
        <div class="box_content_underpage">
            <div class="box_content_underpage1 min_heght">
                <div class="p15t p15l p20r min_heght2">
                    <div class="tt_top_pro2">
                         <div class="boder_white">
                            <div class="float_left p14l p10t">
                                <?php if(1==0){ ?>
									<h4>Product - id:&nbsp;<?php echo $product_number; ?></h4>                                   
									<span class="style3" style="margin: 0 0 0.25em;"><?php echo $short_title; ?></span><br />
									<h4 class="product_title"><?php echo $short_title; ?></h4>
                                <?php } ?>								
								<span class="product_title">Vare-nummer:&nbsp;<span id="product_number"><?php echo $sku; ?></span></span><br />
								<span class="product_title"><?php echo $short_title; ?></span><br />  	
								<?php if(!empty($discounts) || $discount){ ?>
									<span class="style9">Nu:<span id="product_price" class="style9_discount">&nbsp;<?php echo $discount; ?></span></span>&nbsp;&nbsp;&nbsp;&nbsp;
									<span class="style3">Før:<span id="product_price_discount" class="style2_discount">&nbsp;<?php echo $price; ?></span></span>
								<?php }else{ ?>
									<span class="style3">Pris:<span id="product_price" class="style2">&nbsp;<?php echo $price; ?></span></span> 
								<?php } ?>								
								&nbsp;&nbsp;&nbsp;&nbsp;
								<span class="tooltips_shipping">Se pris inkl. fragt/gebyr</span>
								<div id='tooltips_shipping' class="tooltips_shipping_style"><?php echo $shipping_note; ?></div>								
			                </div>     
                            <p class="float_right p20t p15r"><a href="<?php echo 'javascript:history.back()'; //$back; ?>"><img src="catalog/view/theme/<?php echo $template; ?>/images/bt_tibage.png"/></a></p>   			                 
                            <!-- p class="float_right p25t p15r"><a class="osx" href="#" alt="<?php echo $product_link; ?>"><img src="catalog/view/theme/<?php echo $template; ?>/images/bt_tipenven.png"/></a></p -->
                            <p class="cb"></p>
                        </div>
                    </div>
					
                    <!-- product --> 
                    <div id="product_content" class="p2t p15b">
                        <!-- normal view of product images -->
                        <div id="product_normal_view" class="box_all_img_pro_show">  
                            <div class="w336 p15l float_left p20t">        
                                <div class="pr_info_height">
                                    <form action="<?php echo str_replace('&', '&amp;', $action); ?>" method="post" enctype="multipart/form-data" id="product">                                                                         
                                        <?php if($size && false){ ?>
										    <p>Vælg venligst en størrelse:</p>
	                                        <select id="product_option" class="txt_pro w180 float_left" name="option[<?php echo $size['option_id']; ?>]" rel="">
	                                            <option value="none">Vælg variant</option>
	                                             <?php foreach ($size['option_value'] as $option_value) { ?> 
	                                                <option value="<?php echo $option_value['option_value_id']; ?>"><?php echo $option_value['name']; ?>
	                                             <?php } ?>
	                                        </select>   
                                            
                                            <!-- tooltip -->                                 
	                                        <p class="float_left p5t">
	                                    	    <div style="float:left;" class="tooltips_1" >                		             		  
						              			    <img src="catalog/view/theme/<?php echo $template; ?>/images/icon_quetion.png" />           			              			         			
												    <div id='tool_1' class="tooltip-style1_1"><?php echo $size_hint; ?></div>
											    </div> 
											    <!--                                     
	                                    	    <a id="ref_tab_size" href="#tab_size">
	                                    		    <img src="catalog/view/theme/<?php echo $template; ?>/images/icon_quetion.png" />
	                                    	    </a>
											    -->                                    	
	                                        </p>
									    <?php }else{ ?>
                                            <?php foreach ($options as $option) { ?>  
                                                <div style="margin-bottom:5px;">
                                                    <p><?php echo $option['name'] ?>:</p>      
                                                    <select id="product_option_<?php echo $option['option_id']; ?>" class="product_option_list float_left" name="option[<?php echo $option['option_id']; ?>]">
                                                        <option value="none" rel="0" alt="<?php echo $sku; ?>">Vælg <?php echo $option['name'] ?></option>
                                                         <?php foreach ($option['option_value'] as $option_value) { ?> 
                                                            <option value="<?php echo $option_value['option_value_id']; ?>" rel="<?php echo $option_value['price']; ?>" alt="<?php echo $option_value['option_number']; ?>" shape="<?php echo $option_value['quantity']; ?>"><?php echo $option_value['name']; ?></option>
                                                         <?php } ?>
                                                    </select>
                                                    
                                                    <?php if($option['is_size'] && false){ ?>
                                                        <div class="float_left p5t">
                                                            <div style="float:left;" class="tooltips_1">                                               
                                                                <img src="catalog/view/theme/<?php echo $template; ?>/images/icon_quetion.png" />
                                                                <div id='tool_1' class="tooltip-style1_1"><?php echo $size_hint; ?></div>
                                                            </div>                                                                                               
                                                        </div>                                                
                                                    <?php } ?>
                                                    <br class="cb" />                                                
                                                </div> 
                                            <?php } ?>
									    <?php } ?>
                                        <p class="cb"></p>
                                        <p class="p10t">Antal:</p><input id="product_qty" class="txt_pro w30 float_left" name="quantity" type="text" value="1" size="2" maxlength="2" />
                                        <p class="float_left p3t">
                                            <a id="add_to_cart" href="<?php echo '#'; //$success_url; ?>"><img src="catalog/view/theme/<?php echo $template; ?>/images/bt_kobnu.png" height="28" /></a>
                                        </p>
                                        
                                        <input type="hidden" name="product_id" value="<?php echo $product_id; ?>" />
                                        <input type="hidden" name="redirect" value="<?php echo str_replace('&', '&amp;', $redirect); ?>" />                
                                        <input type="hidden" name="product_category" value="<?php echo $product_category; ?>" />
									    <?php if($colors && false){ ?>
										    <input type="hidden" id="color_option_id" name="option[<?php echo $colors_option_id; ?>]" value="" alt="" />
										    <input type="hidden" id="current_color_id" name="current_color_id" value="" alt="" />
									    <?php } ?>                
                                    </form>
                                    <p class="cb"></p>
                                    <div id="color_image_list0" class="box_thump_pro_show p10t p5b">
                                        <?php if ($images) { ?>
                                            <?php foreach ($images as $image) { ?>
                                        	    <a class="cloud-zoom-gallery" href="<?php echo $image['full']; ?>" title="<?php echo $heading_title; ?>" rel="useZoom: 'cloud_zoom', smallImage: '<?php echo $image['popup'];?>'">
                                            	    <img src="<?php echo $image['thumb']; ?>" title="<?php echo $heading_title; ?>" alt="<?php echo $heading_title; ?>" />                                                
                                                </a>
                                            <?php } ?>                                      
                                        <?php } ?>    
                                        <?php if ($video) { ?>
                                            <a class="video_thumb_view" href="#" title="<?php echo $text_video_thumb; ?>" rel="">
                                                <img src="<?php echo $video_thumb; ?>" title="<?php echo $text_video_thumb; ?>" alt="<?php echo $text_video_thumb; ?>" />                                                
                                            </a>
                                        <?php } ?>                                    
                                        <br class="cb" />
                                    </div>										
								    <?php if($colors && false){ ?>
									    <?php $color_index = 1; ?>
									    <?php foreach($colors as $color){ ?>
										    <?php if(!empty($color['image_list'])){ ?>
											    <div id="color_image_list<?php echo $color['color_id']; //$color_index; ?>" class="box_thump_pro_show p10t p5b" style="display: none;">
			                                        <?php foreach($color['image_list'] as $item){ ?>
			                                    	    <a class="cloud-zoom-gallery" href="<?php echo $item['full']; ?>" title="<?php echo $heading_title; ?>" rel="useZoom: 'cloud_zoom', smallImage: '<?php echo $item['popup'];?>'">
			                                        	    <img src="<?php echo $item['thumb']; ?>" title="<?php echo $heading_title; ?>" alt="<?php echo $heading_title; ?>" />                                                
			                                            </a>	                                                                             
			                                        <?php } ?>                                        
			                                        <br class="cb" />
			                                    </div>	
											    <?php $color_index++; ?>
										    <?php } ?>
									    <?php } ?>
									    
									    <?php $column = (count($colors) < 6) ? count($colors) : 6; ?>
									    <?php $width = ($column == 6) ? 300 : ($column * 60); ?>
									    <?php $width = $width - ($column - 1) * 10; ?>
									    <div class="box_color1" style="width:<?php echo $width - 5; ?>px;">									
					                 	    <table width="<?php echo $width; ?>" border="0" cellspacing="0" cellpadding="0">					                      	
											    <tr>
					                      		    <?php $i = 0; ?>
					                      		    <?php foreach($colors as $item){ ?>
						                        	    <td width="60">						                        		
						                        		    <a class="cloud-zoom-gallery"  href="<?php echo $item['full']; ?>" rel="useZoom: 'cloud_zoom', smallImage: '<?php echo $item['popup'];?>'" rev="<?php echo $item['option_value'] ;?>" shape="<?php echo $item['color_id']; //$i + 1; ?>">
						                        			    <img src="<?php echo $item['thumb']; ?>" />
														    </a>
														    <!--
														    <a class="change_color_list"  href="#" rel="color_image_list<?php echo $i + 1; ?>" rev="<?php echo $item['option_value'] ;?>">
						                        			    <img src="<?php echo $item['thumb']; ?>" />
														    </a>
														    -->
													    </td>
													    <?php $i++; ?>
												    <?php } ?>																			                        
					                      	    </tr>
											    <tr>
												    <td id="reset_color_list" colspan="<?php echo $i; ?>" style="padding-top:1px; display:none; font-weight:bold; color:#0000FF;">
													    <?php reset($images); ?>
													    <?php $reset = current($images); ?>													
													    <a class="cloud-zoom-gallery"  href="<?php echo $reset['full']; ?>" rel="useZoom: 'cloud_zoom', smallImage: '<?php echo $reset['popup'];?>'" rev="" shape="0">Standardfarven</a>	
												    </td>												
											    </tr>
					                	    </table>												
					            	    </div>									
								    <?php } ?>     
                                    
                                    <?php if(false && $weight > 0 && $length > 0 && $width > 0 && $height > 0){ ?>   
                                        <div style="margin-top:8px;"> 
                                            <span>Vægt:&nbsp;<b><?php echo $weight . $weight_class['unit']; ?></b></span>&nbsp;-&nbsp;
                                            <span>Dimensioner(L x B x H):&nbsp;<?php echo '<b>' . $length . '</b> x <b>' . $width . '</b> x <b>' . $height . ' ' . $length_class['unit'] . '</b>'; ?></span>                                                    
                                        </div>
                                    <?php } ?>
                                                
                                    <?php if($allow_stock_checkout) { ?>           
                                        <div style="margin-top:6px; font-size: 14px;">
                                            <span>Lagerstatus:&nbsp;</span>
                                            <?php if($stock > 0){ ?>
                                                <img src="catalog/view/theme/<?php echo $template; ?>/images/instock.png" width="12" height="12" /><span style="color:#28B116; font-weight:bold;">&nbsp;&nbsp;På lager<?php //echo $stock . '&nbsp;på lager'; ?></span>
                                            <?php }else{ ?>
                                                <img src="catalog/view/theme/<?php echo $template; ?>/images/outstock.png" width="12" height="12" /><span style="color:#FF0000; font-weight:bold;">&nbsp;&nbsp;Ingen</span> 
                                            <?php } ?>                                    
                                        </div>
                                    <?php } ?>
                                </div>
                                
                                <div>                                    
                                    <a id="send_question_button" title="Send et spørgsmål til dette produkt" href="#"><img src="catalog/view/theme/<?php echo $template; ?>/images/question_for_product.png" alt="" /></a>
                                    <div style="margin-top:4px; font-size: 12px; font-weight: bold;">
                                        <span class="pr_bt_b">Tip en ven</span>                                                                                                                                                                             
                                        <!--
										<a class="pr_button_facebook pr_bt_b" id="send_friend_facebook" title="Send til Facebook" href="#"><span class="pr_bt_bs pr_button_facebook"></span></a>
                                        <a class="pr_button_twitter pr_bt_b" id="send_friend_tweeter" title="Tweet dette" href="#"><span class="pr_bt_bs pr_button_twitter"></span></a>
                                        -->
										<iframe src="//www.facebook.com/plugins/like.php?locale=da_DK&amp;href=<?php echo $current_url; ?>&amp;send=false&amp;layout=button_count&amp;width=100&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font=tahoma&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px; height:21px;" allowTransparency="true"></iframe>										
										<a class="pr_button_email pr_bt_b osx" id="send_friend_email" title="E-mail" href="#"><span class="pr_bt_bs pr_button_email"></span></a>                                                                                                                    
                                        <div class="cb"></div>
                                    </div>
                                    
                                    <div id="add_product_error" style="display:none; color:#FAAAF0; margin-top:15px; font-weight:bold; font-size:12px;"></div>
                                </div>
                            </div>
                            <div id="product_image_view">
                                <div class="w300 p10t p15l float_right" style="z-index: 50; position: relative;"> 
                            	    <a id="cloud_zoom" class='cloud-zoom' href="<?php echo $full; ?>" title="<?php echo $heading_title; ?>" rel="adjustX: -10, adjustY: 0, position: 'left', zoomWidth: 450, zoomHeight: 535, titleOpacity: 1"> <!-- , tint: '#C0C0C0', tintOpacity: 0.5 -->                                    
                                	    <img id="image" src="<?php echo $thumb; ?>" title="<?php echo $heading_title; ?>" alt="<?php echo $heading_title; ?>" width="220" height="316" />
                                    </a>
                                </div>
                                <div class="box_zom" style="z-index: 900;">  
                                    <a id="zoom_view" href="<?php echo $zoom_view; ?>"><img src="catalog/view/theme/<?php echo $template; ?>/images/bt_zoom.png" /></a><a id="size_view" href="#"><img src="catalog/view/theme/<?php echo $template; ?>/images/bt_normal_o.png"/></a>
                                </div>
                            </div>
                            <?php if($video){ ?> 
                                <div id="product_video_view">
                                    <div class="w300 p10t p15l float_right" style="z-index: 50; position: relative;"> 
                                        <?php if(1==0){ ?>
                                        <div id="video_player" rel="<?php echo $video; ?>" style="display:block;width:300px;height:315px"></div>
                                        <?php } if(1==1){ ?>
                                        <div id="video_player" rel="catalog/view/theme/<?php echo $template; ?>/swf/video_container.swf" alt="<?php echo $video; ?>"></div>                                    
                                        <?php } ?>
                                    </div>                                 
                                </div>
                            <?php } ?>
                        </div>  
                        
                        <!-- bottom block  of product information -->   
                        <div class="box_all_tab">
                            <div id="tabs_header" class="tab_pro">
                                <ul>
                                    <li id="tabs_desc_title"><a href="#tab_desc"><span>Om Produktet</span></a></li>
                                    <?php if(($size_guide != '') && ($size_guide != 'none')){ ?>
                                        <?php
                                        $except_list = array(
                                            'hempel_farvekort'  => 'Hempel Farvekort',
                                            'ox_on'             => 'Størrelsesguide',
                                            //'kansas_maleskema'  => 'Kansas måleskema',
                                            //'h2o_sportswear_maleskema_men'     => 'H2O Sportswear Måleskema Herre',
                                            //'h2o_sportswear_maleskema_women'   => 'H2O Sportswear Måleskema Dame',
                                        );
                                        
                                        $except_list_customize = array(
                                            'ox_on'             => 'OX-ON Størrelsesskema',
                                        );
                                        ?>
                                        <?php if(array_key_exists($size_guide, $except_list) && false){ ?>
                                            <li id="tabs_size_title1"><a target="_blank" href="<?php echo $download_link . $size_guide . '.pdf'; ?>"><span>Hent:&nbsp;<?php echo $except_list[$size_guide]; ?>&nbsp;PDF fil.</span></a></li>
                                        <?php }elseif(array_key_exists($size_guide, $except_list)){ ?>   
                                            <li id="tabs_size_title"><a href="#tab_size"><span><?php echo $except_list[$size_guide]; ?></span></a></li>
                                        <?php }else{ ?>
                                            <li id="tabs_size_title"><a href="#tab_size"><span>Størrelsesguide</span></a></li>
                                        <?php } ?>
                                    <?php } ?>
                                    <?php if(!empty($products)){ ?>
                                        <li id="tabs_related_title"><a href="#tab_related_product"><span>VI ANBEFALER OGSÅ</span></a></li>
                                    <?php } ?>
                                </ul>
                                <p class="cb"></p>
                            </div>
                            
                            <!-- Tab description -->                              
                            <div id="tabs_description" class="p10t tabs_content">
                                <?php echo $description; //$manufacturer_desc;?>                                          
                            </div>
                            <!-- Tab size -->
                            <?php if(($size_guide != '') && ($size_guide != 'none')){ ?>
                                <?php if(array_key_exists($size_guide, $except_list)){ ?>
                                    <?php if(array_key_exists($size_guide, $except_list_customize)){ ?>
                                        <div id="tabs_size" class="p20t tabs_content">
                                            <a target="_blank" style="font-size: 14px; color: #0C4F7D;" href="<?php echo $download_link . $size_guide . '.pdf'; ?>"><?php echo $except_list_customize[$size_guide]; ?></a>
                                        </div>
                                    <?php }else{ ?>
                                        <div id="tabs_size" class="p20t tabs_content">
                                            <a target="_blank" style="font-size: 14px; color: #0C4F7D;" href="<?php echo $download_link . $size_guide . '.pdf'; ?>">Hent:&nbsp;<?php echo $except_list[$size_guide]; ?>&nbsp;PDF fil</a>
                                        </div>
                                    <?php } ?>
                                <?php }else{ ?>
                                    <?php echo $size_guide_data; ?>
                                <?php } ?>
                            <?php } ?> 
                            <!-- Tab related product -->
                            <?php if(!empty($products)){ ?>
                                <div id="tabs_related_product" class="p20t" style="display: none;">                   
                                     <div class="tab_related_data">
                                        <table cellspacing="0" cellpadding="0" border="0" width="100%">
                                            <tbody>
                                                <?php $count = count($products); $i = 0; ?>
                                                <?php foreach($products as $related_item){ ?>
                                                    <?php $i++; ?>
                                                    <?php $class = $i == $count ? 'p7' : 'border_bottom p7'; ?>
                                                    <tr>
                                                       <td width="13%" class="<?php echo $class; ?>"><img height="75" width="61" src="<?php echo $related_item['image']; ?>"></td>
                                                       <td width="38%" class="<?php echo $class; ?>"><?php echo $related_item['name']; ?><br>Pris: <span class="style2"><?php echo $related_item['price']; ?></span></td>
                                                       <td width="49%" class="<?php echo $class; ?>"><a href="<?php echo $related_item['href']; ?>"><img src="catalog/view/theme/<?php echo $template; ?>/images/icon_shopping.png"></a></td>
                                                    </tr>
                                                <?php } ?>                                           
                                            </tbody>
                                        </table>
                                    </div>                                
                                </div> 
                            <?php } ?>     
                        </div>
                    </div>                         
                </div> 
                <div id="bottom_nav" class="bt_tab">
                    <p class="p15l float_left p12t"><a href="<?php echo $back; ?>"><img src="catalog/view/theme/<?php echo $template; ?>/images/bt_tibage.png"/></a></p>
                    <p class="p15r float_right p12t"><a href="<?php echo $checkout; ?>"><img src="catalog/view/theme/<?php echo $template; ?>/images/bt_indkobskurven2.png"/></a></p>
                    <p class="cb"></p>
                </div>
                </div>                
            </div>
        
            <div class="box_bottom">
                <div class="all_page_bt"></div>
            </div>
        </div>
        <p class="cb"></p>
    </div>
				
	<!-- popup -->     
    <div id="cart_popup_msg">             
        <div id="cart_popup_content">
            <div class="box_all_pop1">
                <p class="p5t p36b"><img src="catalog/view/theme/<?php echo $template; ?>/images/text_vare.png"/></p>
                <p class="p10t">            	 
				    <a href="<?php echo $checkout; ?>"><img src="catalog/view/theme/<?php echo $template; ?>/images/bt_indkobskurven1.png" style="padding-right:5px" /></a>
				    <a id="close_popup_msg" href="<?php echo '#';//$next_step; ?>"><img src="catalog/view/theme/<?php echo $template; ?>/images/bt_taet.png" /></a>
			    </p>
            </div>
        </div>
    </div>
	 	
    <!-- Tell friend -->
	<?php echo $tellfriend; ?> 
    
    <!-- Send a question -->
    <?php echo $send_question; ?> 
</div>
<!-- End content -->

<!-- Footer -->
<?php echo $footer; ?> 

<link type="text/css" rel="stylesheet" href="catalog/view/theme/<?php echo $template; ?>/css/cloud-zoom.css" />
<script type="text/javascript" src="catalog/view/theme/<?php echo $template; ?>/js/cloud-zoom.1.0.2.js"></script>
<script type="text/javascript" src="catalog/view/theme/<?php echo $template; ?>/js/flowplayer-3.2.6.min.js"></script>

<!-- Add to cart -->
<script type="text/javascript">
//<![CDATA[
	jQuery('a#close_popup_msg').live('click', function(event){    
        event.preventDefault();
        
		jQuery.modal.close();
		/*
    	jQuery('#product_content').show(); 
        jQuery('#bottom_nav').show();
        jQuery('#cart_popup_msg').hide();	 
        */   
	});
	
    var numeric_filter = /(^-?\d\d*\.\d*$)|(^-?\d\d*$)|(^-?\.\d\d*$)|(^-?\d*$)/;   
    var in_stock = <?php echo $stock; ?>; 
    jQuery('#add_to_cart').live('click', function(event){    
        event.preventDefault();                
        
        if(in_stock <= 0){
            confirm('Fejl', 'Dette produkt er ikke længere på lager!', 'notify');    
            //jQuery('#add_product_error').html('<span id="option_error" style="">Dette produkt er ikke længere på lager.</span>');
            
            return false; 
        } 
        
        var size_qty = jQuery("select[id*='product_option_'] option:selected").attr('shape') * 1;
        var qty = jQuery('#product_qty').val();
        if(in_stock < qty || size_qty < qty){
            confirm('Fejl', 'Dette produkt er ikke nok mængde på lager.', 'notify');               
            
            return false; 
        } 
        
        <?php if(1==0){ ?>
		if ((jQuery('#product_option').length > 0) && (jQuery('#product_option').val() == 'none')) {
			//jQuery('#add_product_error').html('<span id="option_error" style="">Dette produkt er ikke længere på lager</span>');
			//jQuery('#add_product_error').show();
			confirm('Fejl', 'Vælg venligst en størrelse!', 'notify');
			
			return false;
		}
        <?php } ?>
        
        var valid_attribute = jQuery('select.product_option_list').length > 0; 
        var option_name = '';
        jQuery('select.product_option_list').each(function(){  
            if(jQuery(this).val() == 'none'){
                valid_attribute = false;
                if(option_name == ''){
                    option_name = jQuery(this).siblings('p').eq(0).html();
                    option_name = option_name.replace(':', '');
                    option_name = option_name.replace(' ', '');
                }
            }             
        });
       
        if(!valid_attribute && (option_name != '')) {  
            //jQuery('#add_product_error').html('<span id="option_error" style="">Vælg venligst en "' + option_name + '"</span>');
            //jQuery('#add_product_error').show();
            confirm('Fejl', 'Vælg venligst en "' + option_name + '"!', 'notify');
            
            return false;
        }
        
        var quantity = jQuery('#product_qty').val() * 1;        
        if (quantity <= 0 || !numeric_filter.test(jQuery('#product_qty').val())){  
            //jQuery('#add_product_error').html('<span id="option_error" style="">Angiv mængde (kun acceptere antal)</span>');
            //jQuery('#add_product_error').show();
            confirm('Fejl', 'Angiv mængde (kun acceptere antal)', 'notify'); 
		
            return false;
        }
        else {
			jQuery('#add_product_error').html('');
			jQuery('#add_product_error').hide();
		}
		
        jQuery.ajax({
            type: 'post',
            url: 'index.php?route=module/cart/refreshCart',
            dataType: 'html',
            data: jQuery('#product :input'),
            success: function (html) {
                jQuery('p#cart_info').html(html);
            },    
            complete: function () { 
				/*
            	//Show and hide panel
                jQuery('#product_content').hide(); 
                jQuery('#bottom_nav').hide();
                 
                jQuery('#cart_popup_msg').css('position', ''); //'absolute');
                jQuery('#cart_popup_msg').show();
                */
                                      
                jQuery('#cart_popup_msg').modal({                
					closeHTML: "",
					opacity: 70,  										
                    //position: ["10%","30%"],
					containerCss:{	
						background: "none",
						border: "none",					
						height: "auto",
						width: "auto",
						padding: 0
						
					},
                    overlayCss: {
                        height: 700
                    }                    
				});
                if(jQuery.browser.msie){
                    jQuery('#cart_popup_msg').html(jQuery('#cart_popup_msg').html());
                }
                
                //window.location = jQuery('#add_to_cart ').attr('href');
                jQuery.get(
                    'index.php?route=module/cart_detailview/loadProduct',                 
                    {'product_key': '', 'nav_status': '' },
                    function(data){
                        jQuery('#product_popup').html(data);
                    },
                    'html'
                );   
            }
        });    
        
        return false;                     
    });
    
    var ref_price = <?php echo $price_ref; ?>;
    jQuery("select[id*='product_option_']").change(function(){
        //var option_price = parseFloat(ref_price);
        var option_price = ref_price;
        var product_number = '';
        
        jQuery("select[id*='product_option_'] option:selected").each(function(){
            //option_price = option_price * 1 + parseFloat(jQuery(this).attr('rel') * 1);    
            option_price = option_price * 1 + jQuery(this).attr('rel') * 1;    
            product_number = jQuery(this).attr('alt');
        })   
            
        option_price = option_price.toFixed(2);
        option_price = option_price.replace('.', ',');
        option_price = option_price.replace(',00', ',-');        
        
        jQuery('#product_price').html(' DKK ' + option_price);
        jQuery('#product_number').html(jQuery('option:selected', this).attr('alt'));
    });
//]]>
</script>        
 
<!-- Product effect -->       
<script type="text/javascript"><!--  
    jQuery(document).ready(function(){
        jQuery('#tabs_desc_title a').trigger('click');   
        //jQuery('#product_normal_view #size_view').trigger('click');

        jQuery('#cloud_zoom').click(function(even){
			even.preventDefault();
        }); 
		
		jQuery('.box_color1 a.cloud-zoom-gallery').click(function(even){
			jQuery('#color_option_id').val(jQuery(this).attr('rev'));	
			jQuery('#current_color_id').val(jQuery(this).attr('shape'));
			
			jQuery('div[id^=\'color_image_list\']').hide();
			jQuery('#color_image_list' + jQuery(this).attr('shape')).show();
			
			if(jQuery(this).attr('shape') != '0')
				jQuery('#reset_color_list').show();
			else{
				jQuery('#reset_color_list').hide();	
			}
        });
		jQuery('.box_color1 a.cloud-zoom-gallery[shape=\'' + <?php echo $current_color; ?> + '\']').trigger('click');
		
		/*
		jQuery('.box_color1 a.change_color_list').click(function(even){
			even.preventDefault();
			
			jQuery('#color_option_id').val(jQuery(this).attr('rev'));
			jQuery('div[id^=\'color_image_list\']').hide();
			jQuery('#' + jQuery(this).attr('rel')).show();	
        });
        */
		
		jQuery('.box_zom #zoom_view').click(function(even){
			var href = jQuery(this).attr('href');
			if (jQuery('#current_color_id').val() * 1 > 0) {
				href += '&color_id=' + jQuery('#current_color_id').val();
			}
			jQuery(this).attr('href', href);
		});
        
        <?php if($video){ ?>
            jQuery('a.video_thumb_view').click(function(even){
                even.preventDefault();
                
                jQuery('#video_player').html('<embed id="video_player_obj" name="video_player_obj" src="' + jQuery('#video_player').attr('rel') + '" flashvars="videoURL=' + jQuery('#video_player').attr('alt') + '" type="application/x-shockwave-flash" width="300" height="315" align="middle" allowfullscreen="true" scale="showall" allowscriptaccess="sameDomain" wmode="transparent" quality="high" bgcolor="#FFFFFF" />');
                /*
                flowplayer(
                    "video_player", 
                    "catalog/view/theme/<?php echo $template; ?>/swf/flowplayer-3.2.7.swf",
                    {
                        clip: {
                            url: jQuery('#video_player').attr('rel'),
                            autoPlay: true,
                            autoBuffering: true
                        },
                        play: {
                            replay: true,
                            label: null,
                            replayLabel: "Klik for at spille igen"
                        }
                    }
                );
                */
                
                jQuery('#product_image_view').hide();
                jQuery('#product_video_view').show();
           }); 
           
            jQuery('a.cloud-zoom-gallery').click(function(even){
                even.preventDefault();
                
                jQuery('#video_player').html('');
                jQuery('#product_image_view').show();
                jQuery('#product_video_view').hide();
            }); 
        <?php } ?>
        
        jQuery('#send_friend_facebook').click(function(event){
            event.preventDefault();
            
            confirm('Implement', 'This function does not finish', 'notify');
        })
        jQuery('#send_friend_tweeter').click(function(event){
            event.preventDefault();
            
            confirm('Implement', 'This function does not finish', 'notify');
        })
    });
    
    // Description and Size
    jQuery('#tabs_desc_title a').click(function(event){
        event.preventDefault();             
        
        if(jQuery('#tabs_size').length > 0){
            if(jQuery('#tabs_size_title').hasClass('current'))
                jQuery('#tabs_size_title').removeClass('current');
            jQuery('#tabs_size').hide();
            
            //jQuery('#tabs_size_title').hasClass('size_current') 
                //jQuery('#tabs_size_title').removeClass('size_current');
        }
        
        if(jQuery('#tabs_related_product').length > 0){
            if(jQuery('#tabs_related_title').hasClass('current'))
                jQuery('#tabs_related_title').removeClass('current'); 
            jQuery('#tabs_related_product').hide();
        }
        
        jQuery('#tabs_desc_title').addClass('current');             
        jQuery('#tabs_description').show();                  
    });                
    
    jQuery('#tabs_size_title a').bind('click', tabSizeClick);  
    jQuery('#ref_tab_size').bind('click', tabSizeClick);  
    
    // Zoom and normal view
    jQuery('#size_view').click(function(event){
        event.preventDefault();            
    });   
        
    function tabSizeClick(event){		
        event.preventDefault();             
        
        if(jQuery('#tabs_size').length <= 0){
            return;
        }
		//if(jQuery('#product_option').length <= 0){
        /*
        if(jQuery('select[id*=\'product_option_\']').length <= 0){  
			return;
		}
		*/
        
        if(jQuery('#tabs_desc_title').hasClass('current'))
            jQuery('#tabs_desc_title').removeClass('current');
        jQuery('#tabs_description').hide();
        
        if(jQuery('#tabs_related_product').length > 0){
            if(jQuery('#tabs_related_title').hasClass('current'))
                jQuery('#tabs_related_title').removeClass('current');
            jQuery('#tabs_related_product').hide();
        }
        
        jQuery('#tabs_size_title').addClass('current');             
        //jQuery('#tabs_size_title').addClass('size_current');
        jQuery('#tabs_size').show();                  
    }
	
    // Related products
    jQuery('#tabs_related_title a').click(function(event){
        event.preventDefault();             
        
        if(jQuery('#tabs_size').length > 0){
            if(jQuery('#tabs_size_title').hasClass('current'))
                jQuery('#tabs_size_title').removeClass('current');
            jQuery('#tabs_size').hide();
            
            //jQuery('#tabs_size_title').hasClass('size_current') 
                //jQuery('#tabs_size_title').removeClass('size_current');
        }
        
        if(jQuery('#tabs_desc_title').hasClass('current'))
            jQuery('#tabs_desc_title').removeClass('current');
        jQuery('#tabs_description').hide();
        
        jQuery('#tabs_related_title').addClass('current');           
        jQuery('#tabs_related_product').show();
                
    });          
    
	jQuery('#product_qty').focus(function(e) {
		if (jQuery(this).val() == 1) {
			jQuery(this).val('');
		}
	});
	jQuery('#product_qty').blur(function(e) {
		if (jQuery(this).val() == '') {
			jQuery(this).val('1');
		}
	}); 
    
    jQuery('#send_question_button').click(function(e) {
        e.preventDefault();
        
        sendQuestionForm(window.location.href);
    }); 
    
//-->
</script>
